<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<style type="text/css">
	div.pagina{display: block;text-align: center;}
	div.pagina ul li{display: inline;}
	div.pagina ul li a{color: #000;float: left;padding: 3px 10px;border: 1px solid #ddd;margin-right:7px;}
	div.pagina ul li a.active {background-color: #00a1e9;color: white;border: 1px solid #00a1e9;}
	div.pagina ul li a:hover:not(.active) {background-color: #ddd;}
	.foot-cent {margin:0 auto;width: 500px;}
</style>

<c:if test="${not empty pageResult and pageResult.lastPage gt 0}">
	<div  class="pagina mt20 clb p10">
		<ul class="fl">
			<c:if test="${pageResult.currentPage>1}">
				<li>
					<a  href="javascript:void(0);" onclick="toPage(0);" title="首页">首页</a>
				</li>
				<li>
					<a  href="javascript:void(0);" onclick="toPage(${pageResult.prePage});"  title="上一页">上一页</a>
				</li>
			</c:if>
			<c:forEach begin="${pageResult.pageBar[0]}" end="${pageResult.pageBar[1]}" varStatus="status">
				<c:if test="${pageResult.currentPage eq status.index}">
					<li>
						<a href="javascript:void(0);" onclick="toPage(${status.index});" class="active">${status.index }</a>
					</li>
				</c:if>
				<c:if test="${pageResult.currentPage ne status.index}">
					<li>
						<a href="javascript:void(0);" onclick="toPage(${status.index});">${status.index }</a>
					</li>
				</c:if>
			</c:forEach>

			<c:if test="${pageResult.currentPage lt pageResult.allPages}">
				<li>
					<a href="javascript:void(0);" onclick="toPage(${pageResult.nextPage});" title="下一页">下一页</a>
					<a href="javascript:void(0);" onclick="toPage(${pageResult.allPages});" title="尾页">尾页</a>
				</li>
			</c:if>
		</ul>
	</div>
</c:if>
<script>
	// 跳转
	function toCustomPage(e){
		var currPage = $(e).prev('span').find('.J_customPage').val();
		toPage(currPage);
	}
	
	// 普通提交跳转到指定页面
	function toPage(pageIndex){
		$("#currentPage").val(pageIndex);
		$('#searchForm').submit();
	}
	
	function toCustomPageByKeyDown(e){
		$(e).parent().next().click();
	}
</script>